/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service.publics.impl;

import dao.publics.WorkstationDao;
import java.util.List;
import java.util.Map;
import model.publics.Workstation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import service.publics.WorkstationService;
import utility.NameValueList;
import utility.StringUtils;

/**
 *
 * @author Lalugina
 */
@Service("workstationService")
@Transactional(readOnly=true)
public class WorkstationServiceImpl implements WorkstationService {

    @Autowired private WorkstationDao dao;
    
    @Override
    @Transactional
    public boolean save(Workstation data) {
        return dao.save(data);
    }

    @Override
    @Transactional
    public boolean delete(Workstation data) {
        return dao.delete(data);
    }

    @Override
    public Workstation get(String id) {
        return dao.getByParam(id);
    }

    @Override
    public List<Workstation> getAll(Map<NameValueList, Object> params) {
        String query = "from Workstation "+StringUtils.getFilter(params);
        return dao.getAll(query);
    }
    
}
